# 预定义一组标准颜色名称和对应的 RGB 值
FLUX_SDXL_NAME_TO_HEX = {
    'coral': '#FA7060',
    'gray': '#ADB0B0',
    'sepia': '#FBD396',
    'buff': '#F7D095',
    'peach': '#FEC6A5',
    'maroon': '#670106',
    'white': '#FCFCFB',
    'may green': '#35D042',
    'cocoa': '#A4411C',
    'carmine': '#F80718',
    'cyan': '#15E2E5',
    'celadon': '#98E9BC',
    'yinmn blue': '#0698E2',
    'indigo': '#001E5C',
    'nickel': '#A8A7A5',
    'dodgerblue': '#0081CE',
    'hot pink': '#FE539F',
    'navy blue': '#001B45',
    'blue': '#08B1E9',
    'sandy brown': '#FAC27E',
    'savoy blue': '#015EA2',
    'tan': '#FDC47B',
    'spring green': '#58FB29',
    'amber': '#F17701',
    'olive green': '#5B6404',
    'plum purple': '#66006F',
    'mulberry': '#BB0967',
    'eggplant': '#860F6E',
    'wisteria purple': '#D28FFA',
    'lemon chiffon': '#FEF672',
    'melon': '#FEB684',
    'yellow orange': '#FEB405',
    'aubergine': '#790055',
    'orange': '#FB7600',
    'amaranth': '#AD0025',
    'bisque': '#FED7AE',
    'ebony': '#05090C',
    'deep pink': '#F9588F',
    'burgundy': '#850018',
    'rust': '#E02801',
    'persimmon': '#F66F03',
    'prussian blue': '#0057C0',
    'brass': '#DD8E13',
    'purple': '#9319C7',
    'blue gray': '#5D9BC0',
    'puce': '#F86985',
    'caribbean green': '#06C56B',
    'burnt sienna': '#FA720B',
    'hunter green': '#197B29',
    'russet': '#BC4A05',
    'khaki': '#C49E6A',
    'lilac': '#E4BFF9',
    'jade': '#04B16F',
    'midnight blue': '#001D4C',
    'slate gray': '#464E53',
    'goldenrod': '#FECB05',
    'charcoal': '#0F1216',
    'silver': '#D1D2D2',
    'teal': '#14C5B0',
    'emerald green': '#00914A',
    'violet': '#A52DD7',
    'powder blue': '#92E5F9',
    'aquamarine': '#63F4ED',
    'claret': '#94001E',
    'honeydew': '#FEE66A',
    'cerulean': '#1BCFE2',
    'lavender': '#DABFF7',
    'cadmium yellow': '#FEDA03',
    'oxblood': '#88000C',
    'gold': '#E5B01D',
    'amethyst purple': '#9214B4',
    'rosegold': '#FEA577',
    'magenta': '#F10B86',
    'venetian red': '#CB0003',
    'ultramarine blue': '#005FC5',
    'mint green': '#9BFCC7',
    'persian green': '#26B84B',
    'tangerine orange': '#FE8403',
    'bronze': '#865C26',
    'onyx': '#1D1F28',
    'black': '#010101',
    'sky blue': '#69E2FC',
    'sea green': '#5AE0B7',
    'mauve': '#D76C77',
    'pacific blue': '#109FD7',
    'blue violet': '#5131E4',
    'royal blue': '#005CD6',
    'saffron': '#FEBC05',
    'yellow': '#FCDE00',
    'umber': '#F06212',
    'pink': '#FEABC7',
    'apricot': '#FEB171',
    'chocolate': '#6B2108',
    'linen': '#F4EFE4',
    'wine': '#930020',
    'plum': '#5D0051',
    'lime green': '#A2FE10',
    'blanched almond': '#FDE4C6',
    'sage': '#9FDDB0',
    'mahogany': '#9D1902',
    'cornflower blue': '#54C4FE',
    'turmeric': '#FEBB00',
    'tyrian purple': '#5E0071',
    'turquoise': '#2BF1DC',
    'taupe': '#DEBB95',
    'carnelian': '#FC3106',
    'blush': '#FEC0C3',
    'alice blue': '#8AE5FA',
    'pullman brown': '#51270B',
    'lapis lazuli': '#0038B0',
    'aureolin': '#FEC132',
    'saddlebrown': '#C76728',
    'orange red': '#FE4207',
    'maize': '#FECD17',
    'cobalt blue': '#0049CA',
    'chestnut': '#C85817',
    'cornsilk': '#FEE66B',
    'royal purple': '#7000B4',
    'copper': '#E7561C',
    'terra cotta': '#FC6029',
    'scarlet': '#D30000',
    'red': '#E10000',
    'cream': '#FCF0D3',
    'vermilion': '#E90001',
    'rebecca purple': '#B63DCD',
    'robin egg blue': '#8AEEEC',
    'vanilla': '#FEEFD0',
    'sienna': '#FC8D29',
    'cerise': '#FE4277',
    'alabaster': '#FAEEDC',
    'baby blue': '#A0EDFE',
    'beige': '#FAE1BB',
    'jazzberry jam': '#F3238A',
    'carnation pink': '#FEAEC3',
    'seafoam': '#A4F6E5',
    'ochre': '#F69402',
    'salmon': '#F97D4D',
    'viridian': '#02AB41',
    'sand': '#FED99E',
    'rufous': '#FE5111',
    'ivory': '#F8F0D3',
    'heliotrope': '#B36FCD',
    'antique white': '#F8F7EE',
    'slate blue': '#0D5984',
    'citrine': '#FEC83C',
    'ash gray': '#9FA5A8',
    'brown': '#99470C',
    'periwinkle': '#96BCFA',
    'green': '#37DF42',
    'caramel': '#FE9F36',
    'yellow green': '#D2FE14',
    'chartreuse': '#B9FE00',
    'crimson': '#C20000',
    'mustard': '#F9B800',
    'lemon yellow': '#FEF01B'
}


CSS3_NAMES_TO_HEX = {
    "aliceblue": "#f0f8ff",
    "antiquewhite": "#faebd7",
    "aqua": "#00ffff",
    "aquamarine": "#7fffd4",
    "azure": "#f0ffff",
    "beige": "#f5f5dc",
    "bisque": "#ffe4c4",
    "black": "#000000",
    "blanchedalmond": "#ffebcd",
    "blue": "#0000ff",
    "blueviolet": "#8a2be2",
    "brown": "#a52a2a",
    "burlywood": "#deb887",
    "cadetblue": "#5f9ea0",
    "chartreuse": "#7fff00",
    "chocolate": "#d2691e",
    "coral": "#ff7f50",
    "cornflowerblue": "#6495ed",
    "cornsilk": "#fff8dc",
    "crimson": "#dc143c",
    "cyan": "#00ffff",
    "darkblue": "#00008b",
    "darkcyan": "#008b8b",
    "darkgoldenrod": "#b8860b",
    "darkgray": "#a9a9a9",
    "darkgrey": "#a9a9a9",
    "darkgreen": "#006400",
    "darkkhaki": "#bdb76b",
    "darkmagenta": "#8b008b",
    "darkolivegreen": "#556b2f",
    "darkorange": "#ff8c00",
    "darkorchid": "#9932cc",
    "darkred": "#8b0000",
    "darksalmon": "#e9967a",
    "darkseagreen": "#8fbc8f",
    "darkslateblue": "#483d8b",
    "darkslategray": "#2f4f4f",
    "darkslategrey": "#2f4f4f",
    "darkturquoise": "#00ced1",
    "darkviolet": "#9400d3",
    "deeppink": "#ff1493",
    "deepskyblue": "#00bfff",
    "dimgray": "#696969",
    "dimgrey": "#696969",
    "dodgerblue": "#1e90ff",
    "firebrick": "#b22222",
    "floralwhite": "#fffaf0",
    "forestgreen": "#228b22",
    "fuchsia": "#ff00ff",
    "gainsboro": "#dcdcdc",
    "ghostwhite": "#f8f8ff",
    "gold": "#ffd700",
    "goldenrod": "#daa520",
    "gray": "#808080",
    "grey": "#808080",
    "green": "#008000",
    "greenyellow": "#adff2f",
    "honeydew": "#f0fff0",
    "hotpink": "#ff69b4",
    "indianred": "#cd5c5c",
    "indigo": "#4b0082",
    "ivory": "#fffff0",
    "khaki": "#f0e68c",
    "lavender": "#e6e6fa",
    "lavenderblush": "#fff0f5",
    "lawngreen": "#7cfc00",
    "lemonchiffon": "#fffacd",
    "lightblue": "#add8e6",
    "lightcoral": "#f08080",
    "lightcyan": "#e0ffff",
    "lightgoldenrodyellow": "#fafad2",
    "lightgray": "#d3d3d3",
    "lightgrey": "#d3d3d3",
    "lightgreen": "#90ee90",
    "lightpink": "#ffb6c1",
    "lightsalmon": "#ffa07a",
    "lightseagreen": "#20b2aa",
    "lightskyblue": "#87cefa",
    "lightslategray": "#778899",
    "lightslategrey": "#778899",
    "lightsteelblue": "#b0c4de",
    "lightyellow": "#ffffe0",
    "lime": "#00ff00",
    "limegreen": "#32cd32",
    "linen": "#faf0e6",
    "magenta": "#ff00ff",
    "maroon": "#800000",
    "mediumaquamarine": "#66cdaa",
    "mediumblue": "#0000cd",
    "mediumorchid": "#ba55d3",
    "mediumpurple": "#9370db",
    "mediumseagreen": "#3cb371",
    "mediumslateblue": "#7b68ee",
    "mediumspringgreen": "#00fa9a",
    "mediumturquoise": "#48d1cc",
    "mediumvioletred": "#c71585",
    "midnightblue": "#191970",
    "mintcream": "#f5fffa",
    "mistyrose": "#ffe4e1",
    "moccasin": "#ffe4b5",
    "navajowhite": "#ffdead",
    "navy": "#000080",
    "oldlace": "#fdf5e6",
    "olive": "#808000",
    "olivedrab": "#6b8e23",
    "orange": "#ffa500",
    "orangered": "#ff4500",
    "orchid": "#da70d6",
    "palegoldenrod": "#eee8aa",
    "palegreen": "#98fb98",
    "paleturquoise": "#afeeee",
    "palevioletred": "#db7093",
    "papayawhip": "#ffefd5",
    "peachpuff": "#ffdab9",
    "peru": "#cd853f",
    "pink": "#ffc0cb",
    "plum": "#dda0dd",
    "powderblue": "#b0e0e6",
    "purple": "#800080",
    "red": "#ff0000",
    "rosybrown": "#bc8f8f",
    "royalblue": "#4169e1",
    "saddlebrown": "#8b4513",
    "salmon": "#fa8072",
    "sandybrown": "#f4a460",
    "seagreen": "#2e8b57",
    "seashell": "#fff5ee",
    "sienna": "#a0522d",
    "silver": "#c0c0c0",
    "skyblue": "#87ceeb",
    "slateblue": "#6a5acd",
    "slategray": "#708090",
    "slategrey": "#708090",
    "snow": "#fffafa",
    "springgreen": "#00ff7f",
    "steelblue": "#4682b4",
    "tan": "#d2b48c",
    "teal": "#008080",
    "thistle": "#d8bfd8",
    "tomato": "#ff6347",
    "turquoise": "#40e0d0",
    "violet": "#ee82ee",
    "wheat": "#f5deb3",
    "white": "#ffffff",
    "whitesmoke": "#f5f5f5",
    "yellow": "#ffff00",
    "yellowgreen": "#9acd32"
}

XKCD_NAME_TO_HEX = {
    "cloudy blue": "#acc2d9",
    "dark pastel green": "#56ae57",
    "dust": "#b2996e",
    "electric lime": "#a8ff04",
    "fresh green": "#69d84f",
    "light eggplant": "#894585",
    "nasty green": "#70b23f",
    "really light blue": "#d4ffff",
    "tea": "#65ab7c",
    "warm purple": "#952e8f",
    "yellowish tan": "#fcfc81",
    "cement": "#a5a391",
    "dark grass green": "#388004",
    "dusty teal": "#4c9085",
    "grey teal": "#5e9b8a",
    "macaroni and cheese": "#efb435",
    "pinkish tan": "#d99b82",
    "spruce": "#0a5f38",
    "strong blue": "#0c06f7",
    "toxic green": "#61de2a",
    "windows blue": "#3778bf",
    "blue blue": "#2242c7",
    "blue with a hint of purple": "#533cc6",
    "booger": "#9bb53c",
    "bright sea green": "#05ffa6",
    "dark green blue": "#1f6357",
    "deep turquoise": "#017374",
    "green teal": "#0cb577",
    "strong pink": "#ff0789",
    "bland": "#afa88b",
    "deep aqua": "#08787f",
    "lavender pink": "#dd85d7",
    "light moss green": "#a6c875",
    "light seafoam green": "#a7ffb5",
    "olive yellow": "#c2b709",
    "pig pink": "#e78ea5",
    "deep lilac": "#966ebd",
    "desert": "#ccad60",
    "dusty lavender": "#ac86a8",
    "purpley grey": "#947e94",
    "purply": "#983fb2",
    "candy pink": "#ff63e9",
    "light pastel green": "#b2fba5",
    "boring green": "#63b365",
    "kiwi green": "#8ee53f",
    "light grey green": "#b7e1a1",
    "orange pink": "#ff6f52",
    "tea green": "#bdf8a3",
    "very light brown": "#d3b683",
    "egg shell": "#fffcc4",
    "eggplant purple": "#430541",
    "powder pink": "#ffb2d0",
    "reddish grey": "#997570",
    "baby shit brown": "#ad900d",
    "liliac": "#c48efd",
    "stormy blue": "#507b9c",
    "ugly brown": "#7d7103",
    "custard": "#fffd78",
    "darkish pink": "#da467d",
    "deep brown": "#410200",
    "greenish beige": "#c9d179",
    "manilla": "#fffa86",
    "off blue": "#5684ae",
    "battleship grey": "#6b7c85",
    "browny green": "#6f6c0a",
    "bruise": "#7e4071",
    "kelley green": "#009337",
    "sickly yellow": "#d0e429",
    "sunny yellow": "#fff917",
    "azul": "#1d5dec",
    "darkgreen": "#054907",
    "green/yellow": "#b5ce08",
    "lichen": "#8fb67b",
    "light light green": "#c8ffb0",
    "pale gold": "#fdde6c",
    "sun yellow": "#ffdf22",
    "tan green": "#a9be70",
    "burple": "#6832e3",
    "butterscotch": "#fdb147",
    "toupe": "#c7ac7d",
    "dark cream": "#fff39a",
    "indian red": "#850e04",
    "light lavendar": "#efc0fe",
    "poison green": "#40fd14",
    "baby puke green": "#b6c406",
    "bright yellow green": "#9dff00",
    "charcoal grey": "#3c4142",
    "squash": "#f2ab15",
    "cinnamon": "#ac4f06",
    "light pea green": "#c4fe82",
    "radioactive green": "#2cfa1f",
    "raw sienna": "#9a6200",
    "baby purple": "#ca9bf7",
    "cocoa": "#875f42",
    "light royal blue": "#3a2efe",
    "orangeish": "#fd8d49",
    "rust brown": "#8b3103",
    "sand brown": "#cba560",
    "swamp": "#698339",
    "tealish green": "#0cdc73",
    "burnt siena": "#b75203",
    "camo": "#7f8f4e",
    "dusk blue": "#26538d",
    "fern": "#63a950",
    "old rose": "#c87f89",
    "pale light green": "#b1fc99",
    "peachy pink": "#ff9a8a",
    "rosy pink": "#f6688e",
    "light bluish green": "#76fda8",
    "light bright green": "#53fe5c",
    "light neon green": "#4efd54",
    "light seafoam": "#a0febf",
    "tiffany blue": "#7bf2da",
    "washed out green": "#bcf5a6",
    "browny orange": "#ca6b02",
    "nice blue": "#107ab0",
    "sapphire": "#2138ab",
    "greyish teal": "#719f91",
    "orangey yellow": "#fdb915",
    "parchment": "#fefcaf",
    "straw": "#fcf679",
    "very dark brown": "#1d0200",
    "terracota": "#cb6843",
    "ugly blue": "#31668a",
    "clear blue": "#247afd",
    "creme": "#ffffb6",
    "foam green": "#90fda9",
    "grey/green": "#86a17d",
    "light gold": "#fddc5c",
    "seafoam blue": "#78d1b6",
    "topaz": "#13bbaf",
    "violet pink": "#fb5ffc",
    "wintergreen": "#20f986",
    "yellow tan": "#ffe36e",
    "dark fuchsia": "#9d0759",
    "indigo blue": "#3a18b1",
    "light yellowish green": "#c2ff89",
    "pale magenta": "#d767ad",
    "rich purple": "#720058",
    "sunflower yellow": "#ffda03",
    "green/blue": "#01c08d",
    "leather": "#ac7434",
    "racing green": "#014600",
    "vivid purple": "#9900fa",
    "dark royal blue": "#02066f",
    "hazel": "#8e7618",
    "muted pink": "#d1768f",
    "booger green": "#96b403",
    "canary": "#fdff63",
    "cool grey": "#95a3a6",
    "dark taupe": "#7f684e",
    "darkish purple": "#751973",
    "true green": "#089404",
    "coral pink": "#ff6163",
    "dark sage": "#598556",
    "dark slate blue": "#214761",
    "flat blue": "#3c73a8",
    "mushroom": "#ba9e88",
    "rich blue": "#021bf9",
    "dirty purple": "#734a65",
    "greenblue": "#23c48b",
    "icky green": "#8fae22",
    "light khaki": "#e6f2a2",
    "warm blue": "#4b57db",
    "dark hot pink": "#d90166",
    "deep sea blue": "#015482",
    "carmine": "#9d0216",
    "dark yellow green": "#728f02",
    "pale peach": "#ffe5ad",
    "plum purple": "#4e0550",
    "golden rod": "#f9bc08",
    "neon red": "#ff073a",
    "old pink": "#c77986",
    "very pale blue": "#d6fffe",
    "blood orange": "#fe4b03",
    "grapefruit": "#fd5956",
    "sand yellow": "#fce166",
    "clay brown": "#b2713d",
    "dark blue grey": "#1f3b4d",
    "flat green": "#699d4c",
    "light green blue": "#56fca2",
    "warm pink": "#fb5581",
    "dodger blue": "#3e82fc",
    "gross green": "#a0bf16",
    "ice": "#d6fffa",
    "metallic blue": "#4f738e",
    "pale salmon": "#ffb19a",
    "sap green": "#5c8b15",
    "algae": "#54ac68",
    "bluey grey": "#89a0b0",
    "greeny grey": "#7ea07a",
    "highlighter green": "#1bfc06",
    "light light blue": "#cafffb",
    "light mint": "#b6ffbb",
    "raw umber": "#a75e09",
    "vivid blue": "#152eff",
    "deep lavender": "#8d5eb7",
    "dull teal": "#5f9e8f",
    "light greenish blue": "#63f7b4",
    "mud green": "#606602",
    "pinky": "#fc86aa",
    "red wine": "#8c0034",
    "shit green": "#758000",
    "tan brown": "#ab7e4c",
    "darkblue": "#030764",
    "rosa": "#fe86a4",
    "lipstick": "#d5174e",
    "pale mauve": "#fed0fc",
    "claret": "#680018",
    "dandelion": "#fedf08",
    "orangered": "#fe420f",
    "poop green": "#6f7c00",
    "ruby": "#ca0147",
    "dark": "#1b2431",
    "greenish turquoise": "#00fbb0",
    "pastel red": "#db5856",
    "piss yellow": "#ddd618",
    "bright cyan": "#41fdfe",
    "dark coral": "#cf524e",
    "algae green": "#21c36f",
    "darkish red": "#a90308",
    "reddy brown": "#6e1005",
    "blush pink": "#fe828c",
    "camouflage green": "#4b6113",
    "lawn green": "#4da409",
    "putty": "#beae8a",
    "vibrant blue": "#0339f8",
    "dark sand": "#a88f59",
    "purple/blue": "#5d21d0",
    "saffron": "#feb209",
    "twilight": "#4e518b",
    "warm brown": "#964e02",
    "bluegrey": "#85a3b2",
    "bubble gum pink": "#ff69af",
    "duck egg blue": "#c3fbf4",
    "greenish cyan": "#2afeb7",
    "petrol": "#005f6a",
    "royal": "#0c1793",
    "butter": "#ffff81",
    "dusty orange": "#f0833a",
    "off yellow": "#f1f33f",
    "pale olive green": "#b1d27b",
    "orangish": "#fc824a",
    "leaf": "#71aa34",
    "light blue grey": "#b7c9e2",
    "dried blood": "#4b0101",
    "lightish purple": "#a552e6",
    "rusty red": "#af2f0d",
    "lavender blue": "#8b88f8",
    "light grass green": "#9af764",
    "light mint green": "#a6fbb2",
    "sunflower": "#ffc512",
    "velvet": "#750851",
    "brick orange": "#c14a09",
    "lightish red": "#fe2f4a",
    "pure blue": "#0203e2",
    "twilight blue": "#0a437a",
    "violet red": "#a50055",
    "yellowy brown": "#ae8b0c",
    "carnation": "#fd798f",
    "muddy yellow": "#bfac05",
    "dark seafoam green": "#3eaf76",
    "deep rose": "#c74767",
    "dusty red": "#b9484e",
    "grey/blue": "#647d8e",
    "lemon lime": "#bffe28",
    "purple/pink": "#d725de",
    "brown yellow": "#b29705",
    "purple brown": "#673a3f",
    "wisteria": "#a87dc2",
    "banana yellow": "#fafe4b",
    "lipstick red": "#c0022f",
    "water blue": "#0e87cc",
    "brown grey": "#8d8468",
    "vibrant purple": "#ad03de",
    "baby green": "#8cff9e",
    "barf green": "#94ac02",
    "eggshell blue": "#c4fff7",
    "sandy yellow": "#fdee73",
    "cool green": "#33b864",
    "pale": "#fff9d0",
    "blue/grey": "#758da3",
    "hot magenta": "#f504c9",
    "greyblue": "#77a1b5",
    "purpley": "#8756e4",
    "baby shit green": "#889717",
    "brownish pink": "#c27e79",
    "dark aquamarine": "#017371",
    "diarrhea": "#9f8303",
    "light mustard": "#f7d560",
    "pale sky blue": "#bdf6fe",
    "turtle green": "#75b84f",
    "bright olive": "#9cbb04",
    "dark grey blue": "#29465b",
    "greeny brown": "#696006",
    "lemon green": "#adf802",
    "light periwinkle": "#c1c6fc",
    "seaweed green": "#35ad6b",
    "sunshine yellow": "#fffd37",
    "ugly purple": "#a442a0",
    "medium pink": "#f36196",
    "puke brown": "#947706",
    "very light pink": "#fff4f2",
    "viridian": "#1e9167",
    "bile": "#b5c306",
    "faded yellow": "#feff7f",
    "very pale green": "#cffdbc",
    "vibrant green": "#0add08",
    "bright lime": "#87fd05",
    "spearmint": "#1ef876",
    "light aquamarine": "#7bfdc7",
    "light sage": "#bcecac",
    "yellowgreen": "#bbf90f",
    "baby poo": "#ab9004",
    "dark seafoam": "#1fb57a",
    "deep teal": "#00555a",
    "heather": "#a484ac",
    "rust orange": "#c45508",
    "dirty blue": "#3f829d",
    "fern green": "#548d44",
    "bright lilac": "#c95efb",
    "weird green": "#3ae57f",
    "peacock blue": "#016795",
    "avocado green": "#87a922",
    "faded orange": "#f0944d",
    "grape purple": "#5d1451",
    "hot green": "#25ff29",
    "lime yellow": "#d0fe1d",
    "mango": "#ffa62b",
    "shamrock": "#01b44c",
    "bubblegum": "#ff6cb5",
    "purplish brown": "#6b4247",
    "vomit yellow": "#c7c10c",
    "pale cyan": "#b7fffa",
    "key lime": "#aeff6e",
    "tomato red": "#ec2d01",
    "lightgreen": "#76ff7b",
    "merlot": "#730039",
    "night blue": "#040348",
    "purpleish pink": "#df4ec8",
    "apple": "#6ecb3c",
    "baby poop green": "#8f9805",
    "green apple": "#5edc1f",
    "heliotrope": "#d94ff5",
    "yellow/green": "#c8fd3d",
    "almost black": "#070d0d",
    "cool blue": "#4984b8",
    "leafy green": "#51b73b",
    "mustard brown": "#ac7e04",
    "dusk": "#4e5481",
    "dull brown": "#876e4b",
    "frog green": "#58bc08",
    "vivid green": "#2fef10",
    "bright light green": "#2dfe54",
    "fluro green": "#0aff02",
    "kiwi": "#9cef43",
    "seaweed": "#18d17b",
    "navy green": "#35530a",
    "ultramarine blue": "#1805db",
    "iris": "#6258c4",
    "pastel orange": "#ff964f",
    "yellowish orange": "#ffab0f",
    "perrywinkle": "#8f8ce7",
    "tealish": "#24bca8",
    "dark plum": "#3f012c",
    "pear": "#cbf85f",
    "pinkish orange": "#ff724c",
    "midnight purple": "#280137",
    "light urple": "#b36ff6",
    "dark mint": "#48c072",
    "greenish tan": "#bccb7a",
    "light burgundy": "#a8415b",
    "turquoise blue": "#06b1c4",
    "ugly pink": "#cd7584",
    "sandy": "#f1da7a",
    "electric pink": "#ff0490",
    "muted purple": "#805b87",
    "mid green": "#50a747",
    "greyish": "#a8a495",
    "neon yellow": "#cfff04",
    "banana": "#ffff7e",
    "carnation pink": "#ff7fa7",
    "tomato": "#ef4026",
    "sea": "#3c9992",
    "muddy brown": "#886806",
    "turquoise green": "#04f489",
    "buff": "#fef69e",
    "fawn": "#cfaf7b",
    "muted blue": "#3b719f",
    "pale rose": "#fdc1c5",
    "dark mint green": "#20c073",
    "amethyst": "#9b5fc0",
    "blue/green": "#0f9b8e",
    "chestnut": "#742802",
    "sick green": "#9db92c",
    "pea": "#a4bf20",
    "rusty orange": "#cd5909",
    "stone": "#ada587",
    "rose red": "#be013c",
    "pale aqua": "#b8ffeb",
    "deep orange": "#dc4d01",
    "earth": "#a2653e",
    "mossy green": "#638b27",
    "grassy green": "#419c03",
    "pale lime green": "#b1ff65",
    "light grey blue": "#9dbcd4",
    "pale grey": "#fdfdfe",
    "asparagus": "#77ab56",
    "blueberry": "#464196",
    "purple red": "#990147",
    "pale lime": "#befd73",
    "greenish teal": "#32bf84",
    "caramel": "#af6f09",
    "deep magenta": "#a0025c",
    "light peach": "#ffd8b1",
    "milk chocolate": "#7f4e1e",
    "ocher": "#bf9b0c",
    "off green": "#6ba353",
    "purply pink": "#f075e6",
    "lightblue": "#7bc8f6",
    "dusky blue": "#475f94",
    "golden": "#f5bf03",
    "light beige": "#fffeb6",
    "butter yellow": "#fffd74",
    "dusky purple": "#895b7b",
    "french blue": "#436bad",
    "ugly yellow": "#d0c101",
    "greeny yellow": "#c6f808",
    "orangish red": "#f43605",
    "shamrock green": "#02c14d",
    "orangish brown": "#b25f03",
    "tree green": "#2a7e19",
    "deep violet": "#490648",
    "gunmetal": "#536267",
    "blue/purple": "#5a06ef",
    "cherry": "#cf0234",
    "sandy brown": "#c4a661",
    "warm grey": "#978a84",
    "dark indigo": "#1f0954",
    "midnight": "#03012d",
    "bluey green": "#2bb179",
    "grey pink": "#c3909b",
    "soft purple": "#a66fb5",
    "blood": "#770001",
    "brown red": "#922b05",
    "medium grey": "#7d7f7c",
    "berry": "#990f4b",
    "poo": "#8f7303",
    "purpley pink": "#c83cb9",
    "light salmon": "#fea993",
    "snot": "#acbb0d",
    "easter purple": "#c071fe",
    "light yellow green": "#ccfd7f",
    "dark navy blue": "#00022e",
    "drab": "#828344",
    "light rose": "#ffc5cb",
    "rouge": "#ab1239",
    "purplish red": "#b0054b",
    "slime green": "#99cc04",
    "baby poop": "#937c00",
    "irish green": "#019529",
    "pink/purple": "#ef1de7",
    "dark navy": "#000435",
    "greeny blue": "#42b395",
    "light plum": "#9d5783",
    "pinkish grey": "#c8aca9",
    "dirty orange": "#c87606",
    "rust red": "#aa2704",
    "pale lilac": "#e4cbff",
    "orangey red": "#fa4224",
    "primary blue": "#0804f9",
    "kermit green": "#5cb200",
    "brownish purple": "#76424e",
    "murky green": "#6c7a0e",
    "wheat": "#fbdd7e",
    "very dark purple": "#2a0134",
    "bottle green": "#044a05",
    "watermelon": "#fd4659",
    "deep sky blue": "#0d75f8",
    "fire engine red": "#fe0002",
    "yellow ochre": "#cb9d06",
    "pumpkin orange": "#fb7d07",
    "pale olive": "#b9cc81",
    "light lilac": "#edc8ff",
    "lightish green": "#61e160",
    "carolina blue": "#8ab8fe",
    "mulberry": "#920a4e",
    "shocking pink": "#fe02a2",
    "auburn": "#9a3001",
    "bright lime green": "#65fe08",
    "celadon": "#befdb7",
    "pinkish brown": "#b17261",
    "poo brown": "#885f01",
    "bright sky blue": "#02ccfe",
    "celery": "#c1fd95",
    "dirt brown": "#836539",
    "strawberry": "#fb2943",
    "dark lime": "#84b701",
    "copper": "#b66325",
    "medium brown": "#7f5112",
    "muted green": "#5fa052",
    "robin's egg": "#6dedfd",
    "bright aqua": "#0bf9ea",
    "bright lavender": "#c760ff",
    "ivory": "#ffffcb",
    "very light purple": "#f6cefc",
    "light navy": "#155084",
    "pink red": "#f5054f",
    "olive brown": "#645403",
    "poop brown": "#7a5901",
    "mustard green": "#a8b504",
    "ocean green": "#3d9973",
    "very dark blue": "#000133",
    "dusty green": "#76a973",
    "light navy blue": "#2e5a88",
    "minty green": "#0bf77d",
    "adobe": "#bd6c48",
    "barney": "#ac1db8",
    "jade green": "#2baf6a",
    "bright light blue": "#26f7fd",
    "light lime": "#aefd6c",
    "dark khaki": "#9b8f55",
    "orange yellow": "#ffad01",
    "ocre": "#c69c04",
    "maize": "#f4d054",
    "faded pink": "#de9dac",
    "british racing green": "#05480d",
    "sandstone": "#c9ae74",
    "mud brown": "#60460f",
    "light sea green": "#98f6b0",
    "robin egg blue": "#8af1fe",
    "aqua marine": "#2ee8bb",
    "dark sea green": "#11875d",
    "soft pink": "#fdb0c0",
    "orangey brown": "#b16002",
    "cherry red": "#f7022a",
    "burnt yellow": "#d5ab09",
    "brownish grey": "#86775f",
    "camel": "#c69f59",
    "purplish grey": "#7a687f",
    "marine": "#042e60",
    "greyish pink": "#c88d94",
    "pale turquoise": "#a5fbd5",
    "pastel yellow": "#fffe71",
    "bluey purple": "#6241c7",
    "canary yellow": "#fffe40",
    "faded red": "#d3494e",
    "sepia": "#985e2b",
    "coffee": "#a6814c",
    "bright magenta": "#ff08e8",
    "mocha": "#9d7651",
    "ecru": "#feffca",
    "purpleish": "#98568d",
    "cranberry": "#9e003a",
    "darkish green": "#287c37",
    "brown orange": "#b96902",
    "dusky rose": "#ba6873",
    "melon": "#ff7855",
    "sickly green": "#94b21c",
    "silver": "#c5c9c7",
    "purply blue": "#661aee",
    "purpleish blue": "#6140ef",
    "hospital green": "#9be5aa",
    "shit brown": "#7b5804",
    "mid blue": "#276ab3",
    "amber": "#feb308",
    "easter green": "#8cfd7e",
    "soft blue": "#6488ea",
    "cerulean blue": "#056eee",
    "golden brown": "#b27a01",
    "bright turquoise": "#0ffef9",
    "red pink": "#fa2a55",
    "red purple": "#820747",
    "greyish brown": "#7a6a4f",
    "vermillion": "#f4320c",
    "russet": "#a13905",
    "steel grey": "#6f828a",
    "lighter purple": "#a55af4",
    "bright violet": "#ad0afd",
    "prussian blue": "#004577",
    "slate green": "#658d6d",
    "dirty pink": "#ca7b80",
    "dark blue green": "#005249",
    "pine": "#2b5d34",
    "yellowy green": "#bff128",
    "dark gold": "#b59410",
    "bluish": "#2976bb",
    "darkish blue": "#014182",
    "dull red": "#bb3f3f",
    "pinky red": "#fc2647",
    "bronze": "#a87900",
    "pale teal": "#82cbb2",
    "military green": "#667c3e",
    "barbie pink": "#fe46a5",
    "bubblegum pink": "#fe83cc",
    "pea soup green": "#94a617",
    "dark mustard": "#a88905",
    "shit": "#7f5f00",
    "medium purple": "#9e43a2",
    "very dark green": "#062e03",
    "dirt": "#8a6e45",
    "dusky pink": "#cc7a8b",
    "red violet": "#9e0168",
    "lemon yellow": "#fdff38",
    "pistachio": "#c0fa8b",
    "dull yellow": "#eedc5b",
    "dark lime green": "#7ebd01",
    "denim blue": "#3b5b92",
    "teal blue": "#01889f",
    "lightish blue": "#3d7afd",
    "purpley blue": "#5f34e7",
    "light indigo": "#6d5acf",
    "swamp green": "#748500",
    "brown green": "#706c11",
    "dark maroon": "#3c0008",
    "hot purple": "#cb00f5",
    "dark forest green": "#002d04",
    "faded blue": "#658cbb",
    "drab green": "#749551",
    "light lime green": "#b9ff66",
    "snot green": "#9dc100",
    "yellowish": "#faee66",
    "light blue green": "#7efbb3",
    "bordeaux": "#7b002c",
    "light mauve": "#c292a1",
    "ocean": "#017b92",
    "marigold": "#fcc006",
    "muddy green": "#657432",
    "dull orange": "#d8863b",
    "steel": "#738595",
    "electric purple": "#aa23ff",
    "fluorescent green": "#08ff08",
    "yellowish brown": "#9b7a01",
    "blush": "#f29e8e",
    "soft green": "#6fc276",
    "bright orange": "#ff5b00",
    "lemon": "#fdff52",
    "purple grey": "#866f85",
    "acid green": "#8ffe09",
    "pale lavender": "#eecffe",
    "violet blue": "#510ac9",
    "light forest green": "#4f9153",
    "burnt red": "#9f2305",
    "khaki green": "#728639",
    "cerise": "#de0c62",
    "faded purple": "#916e99",
    "apricot": "#ffb16d",
    "dark olive green": "#3c4d03",
    "grey brown": "#7f7053",
    "green grey": "#77926f",
    "true blue": "#010fcc",
    "pale violet": "#ceaefa",
    "periwinkle blue": "#8f99fb",
    "light sky blue": "#c6fcff",
    "blurple": "#5539cc",
    "green brown": "#544e03",
    "bluegreen": "#017a79",
    "bright teal": "#01f9c6",
    "brownish yellow": "#c9b003",
    "pea soup": "#929901",
    "forest": "#0b5509",
    "barney purple": "#a00498",
    "ultramarine": "#2000b1",
    "purplish": "#94568c",
    "puke yellow": "#c2be0e",
    "bluish grey": "#748b97",
    "dark periwinkle": "#665fd1",
    "dark lilac": "#9c6da5",
    "reddish": "#c44240",
    "light maroon": "#a24857",
    "dusty purple": "#825f87",
    "terra cotta": "#c9643b",
    "avocado": "#90b134",
    "marine blue": "#01386a",
    "teal green": "#25a36f",
    "slate grey": "#59656d",
    "lighter green": "#75fd63",
    "electric green": "#21fc0d",
    "dusty blue": "#5a86ad",
    "golden yellow": "#fec615",
    "bright yellow": "#fffd01",
    "light lavender": "#dfc5fe",
    "umber": "#b26400",
    "poop": "#7f5e00",
    "dark peach": "#de7e5d",
    "jungle green": "#048243",
    "eggshell": "#ffffd4",
    "denim": "#3b638c",
    "yellow brown": "#b79400",
    "dull purple": "#84597e",
    "chocolate brown": "#411900",
    "wine red": "#7b0323",
    "neon blue": "#04d9ff",
    "dirty green": "#667e2c",
    "light tan": "#fbeeac",
    "ice blue": "#d7fffe",
    "cadet blue": "#4e7496",
    "dark mauve": "#874c62",
    "very light blue": "#d5ffff",
    "grey purple": "#826d8c",
    "pastel pink": "#ffbacd",
    "very light green": "#d1ffbd",
    "dark sky blue": "#448ee4",
    "evergreen": "#05472a",
    "dull pink": "#d5869d",
    "aubergine": "#3d0734",
    "mahogany": "#4a0100",
    "reddish orange": "#f8481c",
    "deep green": "#02590f",
    "vomit green": "#89a203",
    "purple pink": "#e03fd8",
    "dusty pink": "#d58a94",
    "faded green": "#7bb274",
    "camo green": "#526525",
    "pinky purple": "#c94cbe",
    "pink purple": "#db4bda",
    "brownish red": "#9e3623",
    "dark rose": "#b5485d",
    "mud": "#735c12",
    "brownish": "#9c6d57",
    "emerald green": "#028f1e",
    "pale brown": "#b1916e",
    "dull blue": "#49759c",
    "burnt umber": "#a0450e",
    "medium green": "#39ad48",
    "clay": "#b66a50",
    "light aqua": "#8cffdb",
    "light olive green": "#a4be5c",
    "brownish orange": "#cb7723",
    "dark aqua": "#05696b",
    "purplish pink": "#ce5dae",
    "dark salmon": "#c85a53",
    "greenish grey": "#96ae8d",
    "jade": "#1fa774",
    "ugly green": "#7a9703",
    "dark beige": "#ac9362",
    "emerald": "#01a049",
    "pale red": "#d9544d",
    "light magenta": "#fa5ff7",
    "sky": "#82cafc",
    "light cyan": "#acfffc",
    "yellow orange": "#fcb001",
    "reddish purple": "#910951",
    "reddish pink": "#fe2c54",
    "orchid": "#c875c4",
    "dirty yellow": "#cdc50a",
    "orange red": "#fd411e",
    "deep red": "#9a0200",
    "orange brown": "#be6400",
    "cobalt blue": "#030aa7",
    "neon pink": "#fe019a",
    "rose pink": "#f7879a",
    "greyish purple": "#887191",
    "raspberry": "#b00149",
    "aqua green": "#12e193",
    "salmon pink": "#fe7b7c",
    "tangerine": "#ff9408",
    "brownish green": "#6a6e09",
    "red brown": "#8b2e16",
    "greenish brown": "#696112",
    "pumpkin": "#e17701",
    "pine green": "#0a481e",
    "charcoal": "#343837",
    "baby pink": "#ffb7ce",
    "cornflower": "#6a79f7",
    "blue violet": "#5d06e9",
    "chocolate": "#3d1c02",
    "greyish green": "#82a67d",
    "scarlet": "#be0119",
    "green yellow": "#c9ff27",
    "dark olive": "#373e02",
    "sienna": "#a9561e",
    "pastel purple": "#caa0ff",
    "terracotta": "#ca6641",
    "aqua blue": "#02d8e9",
    "sage green": "#88b378",
    "blood red": "#980002",
    "deep pink": "#cb0162",
    "grass": "#5cac2d",
    "moss": "#769958",
    "pastel blue": "#a2bffe",
    "bluish green": "#10a674",
    "green blue": "#06b48b",
    "dark tan": "#af884a",
    "greenish blue": "#0b8b87",
    "pale orange": "#ffa756",
    "vomit": "#a2a415",
    "forrest green": "#154406",
    "dark lavender": "#856798",
    "dark violet": "#34013f",
    "purple blue": "#632de9",
    "dark cyan": "#0a888a",
    "olive drab": "#6f7632",
    "pinkish": "#d46a7e",
    "cobalt": "#1e488f",
    "neon purple": "#bc13fe",
    "light turquoise": "#7ef4cc",
    "apple green": "#76cd26",
    "dull green": "#74a662",
    "wine": "#80013f",
    "powder blue": "#b1d1fc",
    "off white": "#ffffe4",
    "electric blue": "#0652ff",
    "dark turquoise": "#045c5a",
    "blue purple": "#5729ce",
    "azure": "#069af3",
    "bright red": "#ff000d",
    "pinkish red": "#f10c45",
    "cornflower blue": "#5170d7",
    "light olive": "#acbf69",
    "grape": "#6c3461",
    "greyish blue": "#5e819d",
    "purplish blue": "#601ef9",
    "yellowish green": "#b0dd16",
    "greenish yellow": "#cdfd02",
    "medium blue": "#2c6fbb",
    "dusty rose": "#c0737a",
    "light violet": "#d6b4fc",
    "midnight blue": "#020035",
    "bluish purple": "#703be7",
    "red orange": "#fd3c06",
    "dark magenta": "#960056",
    "greenish": "#40a368",
    "ocean blue": "#03719c",
    "coral": "#fc5a50",
    "cream": "#ffffc2",
    "reddish brown": "#7f2b0a",
    "burnt sienna": "#b04e0f",
    "brick": "#a03623",
    "sage": "#87ae73",
    "grey green": "#789b73",
    "white": "#ffffff",
    "robin's egg blue": "#98eff9",
    "moss green": "#658b38",
    "steel blue": "#5a7d9a",
    "eggplant": "#380835",
    "light yellow": "#fffe7a",
    "leaf green": "#5ca904",
    "light grey": "#d8dcd6",
    "puke": "#a5a502",
    "pinkish purple": "#d648d7",
    "sea blue": "#047495",
    "pale purple": "#b790d4",
    "slate blue": "#5b7c99",
    "blue grey": "#607c8e",
    "hunter green": "#0b4008",
    "fuchsia": "#ed0dd9",
    "crimson": "#8c000f",
    "pale yellow": "#ffff84",
    "ochre": "#bf9005",
    "mustard yellow": "#d2bd0a",
    "light red": "#ff474c",
    "cerulean": "#0485d1",
    "pale pink": "#ffcfdc",
    "deep blue": "#040273",
    "rust": "#a83c09",
    "light teal": "#90e4c1",
    "slate": "#516572",
    "goldenrod": "#fac205",
    "dark yellow": "#d5b60a",
    "dark grey": "#363737",
    "army green": "#4b5d16",
    "grey blue": "#6b8ba4",
    "seafoam": "#80f9ad",
    "puce": "#a57e52",
    "spring green": "#a9f971",
    "dark orange": "#c65102",
    "sand": "#e2ca76",
    "pastel green": "#b0ff9d",
    "mint": "#9ffeb0",
    "light orange": "#fdaa48",
    "bright pink": "#fe01b1",
    "chartreuse": "#c1f80a",
    "deep purple": "#36013f",
    "dark brown": "#341c02",
    "taupe": "#b9a281",
    "pea green": "#8eab12",
    "puke green": "#9aae07",
    "kelly green": "#02ab2e",
    "seafoam green": "#7af9ab",
    "blue green": "#137e6d",
    "khaki": "#aaa662",
    "burgundy": "#610023",
    "dark teal": "#014d4e",
    "brick red": "#8f1402",
    "royal purple": "#4b006e",
    "plum": "#580f41",
    "mint green": "#8fff9f",
    "gold": "#dbb40c",
    "baby blue": "#a2cffe",
    "yellow green": "#c0fb2d",
    "bright purple": "#be03fd",
    "dark red": "#840000",
    "pale blue": "#d0fefe",
    "grass green": "#3f9b0b",
    "navy": "#01153e",
    "aquamarine": "#04d8b2",
    "burnt orange": "#c04e01",
    "neon green": "#0cff0c",
    "bright blue": "#0165fc",
    "rose": "#cf6275",
    "light pink": "#ffd1df",
    "mustard": "#ceb301",
    "indigo": "#380282",
    "lime": "#aaff32",
    "sea green": "#53fca1",
    "periwinkle": "#8e82fe",
    "dark pink": "#cb416b",
    "olive green": "#677a04",
    "peach": "#ffb07c",
    "pale green": "#c7fdb5",
    "light brown": "#ad8150",
    "hot pink": "#ff028d",
    "black": "#000000",
    "lilac": "#cea2fd",
    "navy blue": "#001146",
    "royal blue": "#0504aa",
    "beige": "#e6daa6",
    "salmon": "#ff796c",
    "olive": "#6e750e",
    "maroon": "#650021",
    "bright green": "#01ff07",
    "dark purple": "#35063e",
    "mauve": "#ae7181",
    "forest green": "#06470c",
    "aqua": "#13eac9",
    "cyan": "#00ffff",
    "tan": "#d1b26f",
    "dark blue": "#00035b",
    "lavender": "#c79fef",
    "turquoise": "#06c2ac",
    "dark green": "#033500",
    "violet": "#9a0eea",
    "light purple": "#bf77f6",
    "lime green": "#89fe05",
    "grey": "#929591",
    "sky blue": "#75bbfd",
    "yellow": "#ffff14",
    "magenta": "#c20078",
    "light green": "#96f97b",
    "orange": "#f97306",
    "teal": "#029386",
    "light blue": "#95d0fc",
    "red": "#e50000",
    "brown": "#653700",
    "pink": "#ff81c0",
    "blue": "#0343df",
    "green": "#15b01a",
    "purple": "#7e1e9c"
}

HTML4_NAMES_TO_HEX = {
    "aqua": "#00ffff",
    "black": "#000000",
    "blue": "#0000ff",
    "fuchsia": "#ff00ff",
    "green": "#008000",
    "gray": "#808080",
    "lime": "#00ff00",
    "maroon": "#800000",
    "navy": "#000080",
    "olive": "#808000",
    "purple": "#800080",
    "red": "#ff0000",
    "silver": "#c0c0c0",
    "teal": "#008080",
    "white": "#ffffff",
    "yellow": "#ffff00"
}

CSS4_NAME_TO_HEX = {
    'aliceblue': '#F0F8FF',
    'antiquewhite': '#FAEBD7',
    'aqua': '#00FFFF',
    'aquamarine': '#7FFFD4',
    'azure': '#F0FFFF',
    'beige': '#F5F5DC',
    'bisque': '#FFE4C4',
    'black': '#000000',
    'blanchedalmond': '#FFEBCD',
    'blue': '#0000FF',
    'blueviolet': '#8A2BE2',
    'brown': '#A52A2A',
    'burlywood': '#DEB887',
    'cadetblue': '#5F9EA0',
    'chartreuse': '#7FFF00',
    'chocolate': '#D2691E',
    'coral': '#FF7F50',
    'cornflowerblue': '#6495ED',
    'cornsilk': '#FFF8DC',
    'crimson': '#DC143C',
    'cyan': '#00FFFF',
    'darkblue': '#00008B',
    'darkcyan': '#008B8B',
    'darkgoldenrod': '#B8860B',
    'darkgray': '#A9A9A9',
    'darkgreen': '#006400',
    'darkgrey': '#A9A9A9',
    'darkkhaki': '#BDB76B',
    'darkmagenta': '#8B008B',
    'darkolivegreen': '#556B2F',
    'darkorange': '#FF8C00',
    'darkorchid': '#9932CC',
    'darkred': '#8B0000',
    'darksalmon': '#E9967A',
    'darkseagreen': '#8FBC8F',
    'darkslateblue': '#483D8B',
    'darkslategray': '#2F4F4F',
    'darkslategrey': '#2F4F4F',
    'darkturquoise': '#00CED1',
    'darkviolet': '#9400D3',
    'deeppink': '#FF1493',
    'deepskyblue': '#00BFFF',
    'dimgray': '#696969',
    'dimgrey': '#696969',
    'dodgerblue': '#1E90FF',
    'firebrick': '#B22222',
    'floralwhite': '#FFFAF0',
    'forestgreen': '#228B22',
    'fuchsia': '#FF00FF',
    'gainsboro': '#DCDCDC',
    'ghostwhite': '#F8F8FF',
    'gold': '#FFD700',
    'goldenrod': '#DAA520',
    'gray': '#808080',
    'green': '#008000',
    'greenyellow': '#ADFF2F',
    'grey': '#808080',
    'honeydew': '#F0FFF0',
    'hotpink': '#FF69B4',
    'indianred': '#CD5C5C',
    'indigo': '#4B0082',
    'ivory': '#FFFFF0',
    'khaki': '#F0E68C',
    'lavender': '#E6E6FA',
    'lavenderblush': '#FFF0F5',
    'lawngreen': '#7CFC00',
    'lemonchiffon': '#FFFACD',
    'lightblue': '#ADD8E6',
    'lightcoral': '#F08080',
    'lightcyan': '#E0FFFF',
    'lightgoldenrodyellow': '#FAFAD2',
    'lightgray': '#D3D3D3',
    'lightgreen': '#90EE90',
    'lightgrey': '#D3D3D3',
    'lightpink': '#FFB6C1',
    'lightsalmon': '#FFA07A',
    'lightseagreen': '#20B2AA',
    'lightskyblue': '#87CEFA',
    'lightslategray': '#778899',
    'lightslategrey': '#778899',
    'lightsteelblue': '#B0C4DE',
    'lightyellow': '#FFFFE0',
    'lime': '#00FF00',
    'limegreen': '#32CD32',
    'linen': '#FAF0E6',
    'magenta': '#FF00FF',
    'maroon': '#800000',
    'mediumaquamarine': '#66CDAA',
    'mediumblue': '#0000CD',
    'mediumorchid': '#BA55D3',
    'mediumpurple': '#9370DB',
    'mediumseagreen': '#3CB371',
    'mediumslateblue': '#7B68EE',
    'mediumspringgreen': '#00FA9A',
    'mediumturquoise': '#48D1CC',
    'mediumvioletred': '#C71585',
    'midnightblue': '#191970',
    'mintcream': '#F5FFFA',
    'mistyrose': '#FFE4E1',
    'moccasin': '#FFE4B5',
    'navajowhite': '#FFDEAD',
    'navy': '#000080',
    'oldlace': '#FDF5E6',
    'olive': '#808000',
    'olivedrab': '#6B8E23',
    'orange': '#FFA500',
    'orangered': '#FF4500',
    'orchid': '#DA70D6',
    'palegoldenrod': '#EEE8AA',
    'palegreen': '#98FB98',
    'paleturquoise': '#AFEEEE',
    'palevioletred': '#DB7093',
    'papayawhip': '#FFEFD5',
    'peachpuff': '#FFDAB9',
    'peru': '#CD853F',
    'pink': '#FFC0CB',
    'plum': '#DDA0DD',
    'powderblue': '#B0E0E6',
    'purple': '#800080',
    'rebeccapurple': '#663399',
    'red': '#FF0000',
    'rosybrown': '#BC8F8F',
    'royalblue': '#4169E1',
    'saddlebrown': '#8B4513',
    'salmon': '#FA8072',
    'sandybrown': '#F4A460',
    'seagreen': '#2E8B57',
    'seashell': '#FFF5EE',
    'sienna': '#A0522D',
    'silver': '#C0C0C0',
    'skyblue': '#87CEEB',
    'slateblue': '#6A5ACD',
    'slategray': '#708090',
    'slategrey': '#708090',
    'snow': '#FFFAFA',
    'springgreen': '#00FF7F',
    'steelblue': '#4682B4',
    'tan': '#D2B48C',
    'teal': '#008080',
    'thistle': '#D8BFD8',
    'tomato': '#FF6347',
    'turquoise': '#40E0D0',
    'violet': '#EE82EE',
    'wheat': '#F5DEB3',
    'white': '#FFFFFF',
    'whitesmoke': '#F5F5F5',
    'yellow': '#FFFF00',
    'yellowgreen': '#9ACD32'
}

WIKI_COLOR_NAME_TO_HEX ={
    'air force blue (raf)': '#5d8aa8',
    'air force blue (usaf)': '#00308f',
    'air superiority blue': '#72a0c1',
    'alabama crimson': '#a32638',
    'alice blue': '#f0f8ff',
    'alizarin crimson': '#e32636',
    'alloy orange': '#c46210',
    'almond': '#efdecd',
    'amaranth': '#e52b50',
    'amber': '#ffbf00',
    'amber (sae/ece)': '#ff7e00',
    'american rose': '#ff033e',
    'amethyst': '#96c',
    'android green': '#a4c639',
    'anti-flash white': '#f2f3f4',
    'antique brass': '#cd9575',
    'antique fuchsia': '#915c83',
    'antique ruby': '#841b2d',
    'antique white': '#faebd7',
    'ao (english)': '#008000',
    'apple green': '#8db600',
    'apricot': '#fbceb1',
    'aqua': '#0ff',
    'aquamarine': '#7fffd4',
    'army green': '#4b5320',
    'arsenic': '#3b444b',
    'arylide yellow': '#e9d66b',
    'ash grey': '#b2beb5',
    'asparagus': '#87a96b',
    'atomic tangerine': '#f96',
    'auburn': '#a52a2a',
    'aureolin': '#fdee00',
    'aurometalsaurus': '#6e7f80',
    'avocado': '#568203',
    'azure': '#007fff',
    'azure mist/web': '#f0ffff',
    'baby blue': '#89cff0',
    'baby blue eyes': '#a1caf1',
    'baby pink': '#f4c2c2',
    'ball blue': '#21abcd',
    'banana mania': '#fae7b5',
    'banana yellow': '#ffe135',
    'barn red': '#7c0a02',
    'battleship grey': '#848482',
    'bazaar': '#98777b',
    'beau blue': '#bcd4e6',
    'beaver': '#9f8170',
    'beige': '#f5f5dc',
    'big dip o’ruby': '#9c2542',
    'bisque': '#ffe4c4',
    'bistre': '#3d2b1f',
    'bittersweet': '#fe6f5e',
    'bittersweet shimmer': '#bf4f51',
    'black': '#000',
    'black bean': '#3d0c02',
    'black leather jacket': '#253529',
    'black olive': '#3b3c36',
    'blanched almond': '#ffebcd',
    'blast-off bronze': '#a57164',
    'bleu de france': '#318ce7',
    'blizzard blue': '#ace5ee',
    'blond': '#faf0be',
    'blue': '#00f',
    'blue bell': '#a2a2d0',
    'blue (crayola)': '#1f75fe',
    'blue gray': '#69c',
    'blue-green': '#0d98ba',
    'blue (munsell)': '#0093af',
    'blue (ncs)': '#0087bd',
    'blue (pigment)': '#339',
    'blue (ryb)': '#0247fe',
    'blue sapphire': '#126180',
    'blue-violet': '#8a2be2',
    'blush': '#de5d83',
    'bole': '#79443b',
    'bondi blue': '#0095b6',
    'bone': '#e3dac9',
    'boston university red': '#c00',
    'bottle green': '#006a4e',
    'boysenberry': '#873260',
    'brandeis blue': '#0070ff',
    'brass': '#b5a642',
    'brick red': '#cb4154',
    'bright cerulean': '#1dacd6',
    'bright green': '#6f0',
    'bright lavender': '#bf94e4',
    'bright maroon': '#c32148',
    'bright pink': '#ff007f',
    'bright turquoise': '#08e8de',
    'bright ube': '#d19fe8',
    'brilliant lavender': '#f4bbff',
    'brilliant rose': '#ff55a3',
    'brink pink': '#fb607f',
    'british racing green': '#004225',
    'bronze': '#cd7f32',
    'brown (traditional)': '#964b00',
    'brown (web)': '#a52a2a',
    'bubble gum': '#ffc1cc',
    'bubbles': '#e7feff',
    'buff': '#f0dc82',
    'bulgarian rose': '#480607',
    'burgundy': '#800020',
    'burlywood': '#deb887',
    'burnt orange': '#c50',
    'burnt sienna': '#e97451',
    'burnt umber': '#8a3324',
    'byzantine': '#bd33a4',
    'byzantium': '#702963',
    'cadet': '#536872',
    'cadet blue': '#5f9ea0',
    'cadet grey': '#91a3b0',
    'cadmium green': '#006b3c',
    'cadmium orange': '#ed872d',
    'cadmium red': '#e30022',
    'cadmium yellow': '#fff600',
    'café au lait': '#a67b5b',
    'café noir': '#4b3621',
    'cal poly green': '#1e4d2b',
    'cambridge blue': '#a3c1ad',
    'camel': '#c19a6b',
    'cameo pink': '#efbbcc',
    'camouflage green': '#78866b',
    'canary yellow': '#ffef00',
    'candy apple red': '#ff0800',
    'candy pink': '#e4717a',
    'capri': '#00bfff',
    'caput mortuum': '#592720',
    'cardinal': '#c41e3a',
    'caribbean green': '#0c9',
    'carmine': '#960018',
    'carmine (m&p)': '#d70040',
    'carmine pink': '#eb4c42',
    'carmine red': '#ff0038',
    'carnation pink': '#ffa6c9',
    'carnelian': '#b31b1b',
    'carolina blue': '#99badd',
    'carrot orange': '#ed9121',
    'catalina blue': '#062a78',
    'ceil': '#92a1cf',
    'celadon': '#ace1af',
    'celadon blue': '#007ba7',
    'celadon green': '#2f847c',
    'celeste (colour)': '#b2ffff',
    'celestial blue': '#4997d0',
    'cerise': '#de3163',
    'cerise pink': '#ec3b83',
    'cerulean': '#007ba7',
    'cerulean blue': '#2a52be',
    'cerulean frost': '#6d9bc3',
    'cg blue': '#007aa5',
    'cg red': '#e03c31',
    'chamoisee': '#a0785a',
    'champagne': '#fad6a5',
    'charcoal': '#36454f',
    'charm pink': '#e68fac',
    'chartreuse (traditional)': '#dfff00',
    'chartreuse (web)': '#7fff00',
    'cherry': '#de3163',
    'cherry blossom pink': '#ffb7c5',
    'chestnut': '#cd5c5c',
    'china pink': '#de6fa1',
    'china rose': '#a8516e',
    'chinese red': '#aa381e',
    'chocolate (traditional)': '#7b3f00',
    'chocolate (web)': '#d2691e',
    'chrome yellow': '#ffa700',
    'cinereous': '#98817b',
    'cinnabar': '#e34234',
    'cinnamon': '#d2691e',
    'citrine': '#e4d00a',
    'classic rose': '#fbcce7',
    'cobalt': '#0047ab',
    'cocoa brown': '#d2691e',
    'coffee': '#6f4e37',
    'columbia blue': '#9bddff',
    'congo pink': '#f88379',
    'cool black': '#002e63',
    'cool grey': '#8c92ac',
    'copper': '#b87333',
    'copper (crayola)': '#da8a67',
    'copper penny': '#ad6f69',
    'copper red': '#cb6d51',
    'copper rose': '#966',
    'coquelicot': '#ff3800',
    'coral': '#ff7f50',
    'coral pink': '#f88379',
    'coral red': '#ff4040',
    'cordovan': '#893f45',
    'corn': '#fbec5d',
    'cornell red': '#b31b1b',
    'cornflower blue': '#6495ed',
    'cornsilk': '#fff8dc',
    'cosmic latte': '#fff8e7',
    'cotton candy': '#ffbcd9',
    'cream': '#fffdd0',
    'crimson': '#dc143c',
    'crimson glory': '#be0032',
    'cyan': '#0ff',
    'cyan (process)': '#00b7eb',
    'daffodil': '#ffff31',
    'dandelion': '#f0e130',
    'dark blue': '#00008b',
    'dark brown': '#654321',
    'dark byzantium': '#5d3954',
    'dark candy apple red': '#a40000',
    'dark cerulean': '#08457e',
    'dark chestnut': '#986960',
    'dark coral': '#cd5b45',
    'dark cyan': '#008b8b',
    'dark electric blue': '#536878',
    'dark goldenrod': '#b8860b',
    'dark gray': '#a9a9a9',
    'dark green': '#013220',
    'dark imperial blue': '#00416a',
    'dark jungle green': '#1a2421',
    'dark khaki': '#bdb76b',
    'dark lava': '#483c32',
    'dark lavender': '#734f96',
    'dark magenta': '#8b008b',
    'dark midnight blue': '#036',
    'dark olive green': '#556b2f',
    'dark orange': '#ff8c00',
    'dark orchid': '#9932cc',
    'dark pastel blue': '#779ecb',
    'dark pastel green': '#03c03c',
    'dark pastel purple': '#966fd6',
    'dark pastel red': '#c23b22',
    'dark pink': '#e75480',
    'dark powder blue': '#039',
    'dark raspberry': '#872657',
    'dark red': '#8b0000',
    'dark salmon': '#e9967a',
    'dark scarlet': '#560319',
    'dark sea green': '#8fbc8f',
    'dark sienna': '#3c1414',
    'dark slate blue': '#483d8b',
    'dark slate gray': '#2f4f4f',
    'dark spring green': '#177245',
    'dark tan': '#918151',
    'dark tangerine': '#ffa812',
    'dark taupe': '#483c32',
    'dark terra cotta': '#cc4e5c',
    'dark turquoise': '#00ced1',
    'dark violet': '#9400d3',
    'dark yellow': '#9b870c',
    'dartmouth green': '#00703c',
    "davy's grey": '#555',
    'debian red': '#d70a53',
    'deep carmine': '#a9203e',
    'deep carmine pink': '#ef3038',
    'deep carrot orange': '#e9692c',
    'deep cerise': '#da3287',
    'deep champagne': '#fad6a5',
    'deep chestnut': '#b94e48',
    'deep coffee': '#704241',
    'deep fuchsia': '#c154c1',
    'deep jungle green': '#004b49',
    'deep lilac': '#95b',
    'deep magenta': '#c0c',
    'deep peach': '#ffcba4',
    'deep pink': '#ff1493',
    'deep ruby': '#843f5b',
    'deep saffron': '#f93',
    'deep sky blue': '#00bfff',
    'deep tuscan red': '#66424d',
    'denim': '#1560bd',
    'desert': '#c19a6b',
    'desert sand': '#edc9af',
    'dim gray': '#696969',
    'dodger blue': '#1e90ff',
    'dogwood rose': '#d71868',
    'dollar bill': '#85bb65',
    'drab': '#967117',
    'duke blue': '#00009c',
    'earth yellow': '#e1a95f',
    'ebony': '#555d50',
    'ecru': '#c2b280',
    'eggplant': '#614051',
    'eggshell': '#f0ead6',
    'egyptian blue': '#1034a6',
    'electric blue': '#7df9ff',
    'electric crimson': '#ff003f',
    'electric cyan': '#0ff',
    'electric green': '#0f0',
    'electric indigo': '#6f00ff',
    'electric lavender': '#f4bbff',
    'electric lime': '#cf0',
    'electric purple': '#bf00ff',
    'electric ultramarine': '#3f00ff',
    'electric violet': '#8f00ff',
    'electric yellow': '#ff0',
    'emerald': '#50c878',
    'english lavender': '#b48395',
    'eton blue': '#96c8a2',
    'fallow': '#c19a6b',
    'falu red': '#801818',
    'fandango': '#b53389',
    'fashion fuchsia': '#f400a1',
    'fawn': '#e5aa70',
    'feldgrau': '#4d5d53',
    'fern green': '#4f7942',
    'ferrari red': '#ff2800',
    'field drab': '#6c541e',
    'fire engine red': '#ce2029',
    'firebrick': '#b22222',
    'flame': '#e25822',
    'flamingo pink': '#fc8eac',
    'flavescent': '#f7e98e',
    'flax': '#eedc82',
    'floral white': '#fffaf0',
    'fluorescent orange': '#ffbf00',
    'fluorescent pink': '#ff1493',
    'fluorescent yellow': '#cf0',
    'folly': '#ff004f',
    'forest green (traditional)': '#014421',
    'forest green (web)': '#228b22',
    'french beige': '#a67b5b',
    'french blue': '#0072bb',
    'french lilac': '#86608e',
    'french lime': '#cf0',
    'french raspberry': '#c72c48',
    'french rose': '#f64a8a',
    'fuchsia': '#f0f',
    'fuchsia (crayola)': '#c154c1',
    'fuchsia pink': '#f7f',
    'fuchsia rose': '#c74375',
    'fulvous': '#e48400',
    'fuzzy wuzzy': '#c66',
    'gainsboro': '#dcdcdc',
    'gamboge': '#e49b0f',
    'ghost white': '#f8f8ff',
    'ginger': '#b06500',
    'glaucous': '#6082b6',
    'glitter': '#e6e8fa',
    'gold (metallic)': '#d4af37',
    'gold (web) (golden)': '#ffd700',
    'golden brown': '#996515',
    'golden poppy': '#fcc200',
    'golden yellow': '#ffdf00',
    'goldenrod': '#daa520',
    'granny smith apple': '#a8e4a0',
    'gray': '#808080',
    'gray-asparagus': '#465945',
    'gray (html/css gray)': '#808080',
    'gray (x11 gray)': '#bebebe',
    'green (color wheel) (x11 green)': '#0f0',
    'green (crayola)': '#1cac78',
    'green (html/css green)': '#008000',
    'green (munsell)': '#00a877',
    'green (ncs)': '#009f6b',
    'green (pigment)': '#00a550',
    'green (ryb)': '#66b032',
    'green-yellow': '#adff2f',
    'grullo': '#a99a86',
    'guppie green': '#00ff7f',
    'halayà úbe': '#663854',
    'han blue': '#446ccf',
    'han purple': '#5218fa',
    'hansa yellow': '#e9d66b',
    'harlequin': '#3fff00',
    'harvard crimson': '#c90016',
    'harvest gold': '#da9100',
    'heart gold': '#808000',
    'heliotrope': '#df73ff',
    'hollywood cerise': '#f400a1',
    'honeydew': '#f0fff0',
    'honolulu blue': '#007fbf',
    "hooker's green": '#49796b',
    'hot magenta': '#ff1dce',
    'hot pink': '#ff69b4',
    'hunter green': '#355e3b',
    'iceberg': '#71a6d2',
    'icterine': '#fcf75e',
    'imperial blue': '#002395',
    'inchworm': '#b2ec5d',
    'india green': '#138808',
    'indian red': '#cd5c5c',
    'indian yellow': '#e3a857',
    'indigo': '#6f00ff',
    'indigo (dye)': '#00416a',
    'indigo (web)': '#4b0082',
    'international klein blue': '#002fa7',
    'international orange (aerospace)': '#ff4f00',
    'international orange (engineering)': '#ba160c',
    'international orange (golden gate bridge)': '#c0362c',
    'iris': '#5a4fcf',
    'isabelline': '#f4f0ec',
    'islamic green': '#009000',
    'ivory': '#fffff0',
    'jade': '#00a86b',
    'jasmine': '#f8de7e',
    'jasper': '#d73b3e',
    'jazzberry jam': '#a50b5e',
    'jet': '#343434',
    'jonquil': '#fada5e',
    'june bud': '#bdda57',
    'jungle green': '#29ab87',
    'kelly green': '#4cbb17',
    'kenyan copper': '#7c1c05',
    'khaki (html/css) (khaki)': '#c3b091',
    'khaki (x11) (light khaki)': '#f0e68c',
    'ku crimson': '#e8000d',
    'la salle green': '#087830',
    'languid lavender': '#d6cadd',
    'lapis lazuli': '#26619c',
    'laser lemon': '#fefe22',
    'laurel green': '#a9ba9d',
    'lava': '#cf1020',
    'lavender blue': '#ccf',
    'lavender blush': '#fff0f5',
    'lavender (floral)': '#b57edc',
    'lavender gray': '#c4c3d0',
    'lavender indigo': '#9457eb',
    'lavender magenta': '#ee82ee',
    'lavender mist': '#e6e6fa',
    'lavender pink': '#fbaed2',
    'lavender purple': '#967bb6',
    'lavender rose': '#fba0e3',
    'lavender (web)': '#e6e6fa',
    'lawn green': '#7cfc00',
    'lemon': '#fff700',
    'lemon chiffon': '#fffacd',
    'lemon lime': '#e3ff00',
    'licorice': '#1a1110',
    'light apricot': '#fdd5b1',
    'light blue': '#add8e6',
    'light brown': '#b5651d',
    'light carmine pink': '#e66771',
    'light coral': '#f08080',
    'light cornflower blue': '#93ccea',
    'light crimson': '#f56991',
    'light cyan': '#e0ffff',
    'light fuchsia pink': '#f984ef',
    'light goldenrod yellow': '#fafad2',
    'light gray': '#d3d3d3',
    'light green': '#90ee90',
    'light khaki': '#f0e68c',
    'light pastel purple': '#b19cd9',
    'light pink': '#ffb6c1',
    'light red ochre': '#e97451',
    'light salmon': '#ffa07a',
    'light salmon pink': '#f99',
    'light sea green': '#20b2aa',
    'light sky blue': '#87cefa',
    'light slate gray': '#789',
    'light taupe': '#b38b6d',
    'light thulian pink': '#e68fac',
    'light yellow': '#ffffe0',
    'lilac': '#c8a2c8',
    'lime (color wheel)': '#bfff00',
    'lime green': '#32cd32',
    'lime (web) (x11 green)': '#0f0',
    'limerick': '#9dc209',
    'lincoln green': '#195905',
    'linen': '#faf0e6',
    'lion': '#c19a6b',
    'little boy blue': '#6ca0dc',
    'liver': '#534b4f',
    'lust': '#e62020',
    'magenta': '#f0f',
    'magenta (dye)': '#ca1f7b',
    'magenta (process)': '#ff0090',
    'magic mint': '#aaf0d1',
    'magnolia': '#f8f4ff',
    'mahogany': '#c04000',
    'maize': '#fbec5d',
    'majorelle blue': '#6050dc',
    'malachite': '#0bda51',
    'manatee': '#979aaa',
    'mango tango': '#ff8243',
    'mantis': '#74c365',
    'mardi gras': '#880085',
    'maroon (crayola)': '#c32148',
    'maroon (html/css)': '#800000',
    'maroon (x11)': '#b03060',
    'mauve': '#e0b0ff',
    'mauve taupe': '#915f6d',
    'mauvelous': '#ef98aa',
    'maya blue': '#73c2fb',
    'meat brown': '#e5b73b',
    'medium aquamarine': '#6da',
    'medium blue': '#0000cd',
    'medium candy apple red': '#e2062c',
    'medium carmine': '#af4035',
    'medium champagne': '#f3e5ab',
    'medium electric blue': '#035096',
    'medium jungle green': '#1c352d',
    'medium lavender magenta': '#dda0dd',
    'medium orchid': '#ba55d3',
    'medium persian blue': '#0067a5',
    'medium purple': '#9370db',
    'medium red-violet': '#bb3385',
    'medium ruby': '#aa4069',
    'medium sea green': '#3cb371',
    'medium slate blue': '#7b68ee',
    'medium spring bud': '#c9dc87',
    'medium spring green': '#00fa9a',
    'medium taupe': '#674c47',
    'medium turquoise': '#48d1cc',
    'medium tuscan red': '#79443b',
    'medium vermilion': '#d9603b',
    'medium violet-red': '#c71585',
    'mellow apricot': '#f8b878',
    'mellow yellow': '#f8de7e',
    'melon': '#fdbcb4',
    'midnight blue': '#191970',
    'midnight green (eagle green)': '#004953',
    'mikado yellow': '#ffc40c',
    'mint': '#3eb489',
    'mint cream': '#f5fffa',
    'mint green': '#98ff98',
    'misty rose': '#ffe4e1',
    'moccasin': '#faebd7',
    'mode beige': '#967117',
    'moonstone blue': '#73a9c2',
    'mordant red 19': '#ae0c00',
    'moss green': '#addfad',
    'mountain meadow': '#30ba8f',
    'mountbatten pink': '#997a8d',
    'msu green': '#18453b',
    'mulberry': '#c54b8c',
    'mustard': '#ffdb58',
    'myrtle': '#21421e',
    'nadeshiko pink': '#f6adc6',
    'napier green': '#2a8000',
    'naples yellow': '#fada5e',
    'navajo white': '#ffdead',
    'navy blue': '#000080',
    'neon carrot': '#ffa343',
    'neon fuchsia': '#fe4164',
    'neon green': '#39ff14',
    'new york pink': '#d7837f',
    'non-photo blue': '#a4dded',
    'north texas green': '#059033',
    'ocean boat blue': '#0077be',
    'ochre': '#c72',
    'office green': '#008000',
    'old gold': '#cfb53b',
    'old lace': '#fdf5e6',
    'old lavender': '#796878',
    'old mauve': '#673147',
    'old rose': '#c08081',
    'olive': '#808000',
    'olive drab #7': '#3c341f',
    'olive drab (web) (olive drab #3)': '#6b8e23',
    'olivine': '#9ab973',
    'onyx': '#353839',
    'opera mauve': '#b784a7',
    'orange (color wheel)': '#ff7f00',
    'orange peel': '#ff9f00',
    'orange-red': '#ff4500',
    'orange (ryb)': '#fb9902',
    'orange (web color)': '#ffa500',
    'orchid': '#da70d6',
    'otter brown': '#654321',
    'ou crimson red': '#900',
    'outer space': '#414a4c',
    'outrageous orange': '#ff6e4a',
    'oxford blue': '#002147',
    'pakistan green': '#060',
    'palatinate blue': '#273be2',
    'palatinate purple': '#682860',
    'pale aqua': '#bcd4e6',
    'pale blue': '#afeeee',
    'pale brown': '#987654',
    'pale carmine': '#af4035',
    'pale cerulean': '#9bc4e2',
    'pale chestnut': '#ddadaf',
    'pale copper': '#da8a67',
    'pale cornflower blue': '#abcdef',
    'pale gold': '#e6be8a',
    'pale goldenrod': '#eee8aa',
    'pale green': '#98fb98',
    'pale lavender': '#dcd0ff',
    'pale magenta': '#f984e5',
    'pale pink': '#fadadd',
    'pale plum': '#dda0dd',
    'pale red-violet': '#db7093',
    'pale robin egg blue': '#96ded1',
    'pale silver': '#c9c0bb',
    'pale spring bud': '#ecebbd',
    'pale taupe': '#bc987e',
    'pale violet-red': '#db7093',
    'pansy purple': '#78184a',
    'papaya whip': '#ffefd5',
    'paris green': '#50c878',
    'pastel blue': '#aec6cf',
    'pastel brown': '#836953',
    'pastel gray': '#cfcfc4',
    'pastel green': '#7d7',
    'pastel magenta': '#f49ac2',
    'pastel orange': '#ffb347',
    'pastel pink': '#dea5a4',
    'pastel purple': '#b39eb5',
    'pastel red': '#ff6961',
    'pastel violet': '#cb99c9',
    'pastel yellow': '#fdfd96',
    'patriarch': '#800080',
    "payne's grey": '#536878',
    'peach': '#ffe5b4',
    'peach (crayola)': '#ffcba4',
    'peach-orange': '#fc9',
    'peach puff': '#ffdab9',
    'peach-yellow': '#fadfad',
    'pear': '#d1e231',
    'pearl': '#eae0c8',
    'pearl aqua': '#88d8c0',
    'pearly purple': '#b768a2',
    'peridot': '#e6e200',
    'periwinkle': '#ccf',
    'persian blue': '#1c39bb',
    'persian green': '#00a693',
    'persian indigo': '#32127a',
    'persian orange': '#d99058',
    'persian pink': '#f77fbe',
    'persian plum': '#701c1c',
    'persian red': '#c33',
    'persian rose': '#fe28a2',
    'persimmon': '#ec5800',
    'peru': '#cd853f',
    'phlox': '#df00ff',
    'phthalo blue': '#000f89',
    'phthalo green': '#123524',
    'piggy pink': '#fddde6',
    'pine green': '#01796f',
    'pink': '#ffc0cb',
    'pink lace': '#ffddf4',
    'pink-orange': '#f96',
    'pink pearl': '#e7accf',
    'pink sherbet': '#f78fa7',
    'pistachio': '#93c572',
    'platinum': '#e5e4e2',
    'plum (traditional)': '#8e4585',
    'plum (web)': '#dda0dd',
    'portland orange': '#ff5a36',
    'powder blue (web)': '#b0e0e6',
    'princeton orange': '#ff8f00',
    'prune': '#701c1c',
    'prussian blue': '#003153',
    'psychedelic purple': '#df00ff',
    'puce': '#c89',
    'pumpkin': '#ff7518',
    'purple heart': '#69359c',
    'purple (html/css)': '#800080',
    'purple mountain majesty': '#9678b6',
    'purple (munsell)': '#9f00c5',
    'purple pizzazz': '#fe4eda',
    'purple taupe': '#50404d',
    'purple (x11)': '#a020f0',
    'quartz': '#51484f',
    'rackley': '#5d8aa8',
    'radical red': '#ff355e',
    'rajah': '#fbab60',
    'raspberry': '#e30b5d',
    'raspberry glace': '#915f6d',
    'raspberry pink': '#e25098',
    'raspberry rose': '#b3446c',
    'raw umber': '#826644',
    'razzle dazzle rose': '#f3c',
    'razzmatazz': '#e3256b',
    'red': '#f00',
    'red-brown': '#a52a2a',
    'red devil': '#860111',
    'red (munsell)': '#f2003c',
    'red (ncs)': '#c40233',
    'red-orange': '#ff5349',
    'red (pigment)': '#ed1c24',
    'red (ryb)': '#fe2712',
    'red-violet': '#c71585',
    'redwood': '#ab4e52',
    'regalia': '#522d80',
    'resolution blue': '#002387',
    'rich black': '#004040',
    'rich brilliant lavender': '#f1a7fe',
    'rich carmine': '#d70040',
    'rich electric blue': '#0892d0',
    'rich lavender': '#a76bcf',
    'rich lilac': '#b666d2',
    'rich maroon': '#b03060',
    'rifle green': '#414833',
    'robin egg blue': '#0cc',
    'rose': '#ff007f',
    'rose bonbon': '#f9429e',
    'rose ebony': '#674846',
    'rose gold': '#b76e79',
    'rose madder': '#e32636',
    'rose pink': '#f6c',
    'rose quartz': '#aa98a9',
    'rose taupe': '#905d5d',
    'rose vale': '#ab4e52',
    'rosewood': '#65000b',
    'rosso corsa': '#d40000',
    'rosy brown': '#bc8f8f',
    'royal azure': '#0038a8',
    'royal blue (traditional)': '#002366',
    'royal blue (web)': '#4169e1',
    'royal fuchsia': '#ca2c92',
    'royal purple': '#7851a9',
    'royal yellow': '#fada5e',
    'rubine red': '#d10056',
    'ruby': '#e0115f',
    'ruby red': '#9b111e',
    'ruddy': '#ff0028',
    'ruddy brown': '#bb6528',
    'ruddy pink': '#e18e96',
    'rufous': '#a81c07',
    'russet': '#80461b',
    'rust': '#b7410e',
    'rusty red': '#da2c43',
    'sacramento state green': '#00563f',
    'saddle brown': '#8b4513',
    'safety orange (blaze orange)': '#ff6700',
    'saffron': '#f4c430',
    'salmon': '#ff8c69',
    'salmon pink': '#ff91a4',
    'sand': '#c2b280',
    'sand dune': '#967117',
    'sandstorm': '#ecd540',
    'sandy brown': '#f4a460',
    'sandy taupe': '#967117',
    'sangria': '#92000a',
    'sap green': '#507d2a',
    'sapphire': '#0f52ba',
    'sapphire blue': '#0067a5',
    'satin sheen gold': '#cba135',
    'scarlet': '#ff2400',
    'scarlet (crayola)': '#fd0e35',
    'school bus yellow': '#ffd800',
    "screamin' green": '#76ff7a',
    'sea blue': '#006994',
    'sea green': '#2e8b57',
    'seal brown': '#321414',
    'seashell': '#fff5ee',
    'selective yellow': '#ffba00',
    'sepia': '#704214',
    'shadow': '#8a795d',
    'shamrock green': '#009e60',
    'shocking pink': '#fc0fc0',
    'shocking pink (crayola)': '#ff6fff',
    'sienna': '#882d17',
    'silver': '#c0c0c0',
    'sinopia': '#cb410b',
    'skobeloff': '#007474',
    'sky blue': '#87ceeb',
    'sky magenta': '#cf71af',
    'slate blue': '#6a5acd',
    'slate gray': '#708090',
    'smalt (dark powder blue)': '#039',
    'smokey topaz': '#933d41',
    'smoky black': '#100c08',
    'snow': '#fffafa',
    'spiro disco ball': '#0fc0fc',
    'spring bud': '#a7fc00',
    'spring green': '#00ff7f',
    "st. patrick's blue": '#23297a',
    'steel blue': '#4682b4',
    'stil de grain yellow': '#fada5e',
    'stizza': '#900',
    'stormcloud': '#4f666a',
    'straw': '#e4d96f',
    'sunglow': '#fc3',
    'sunset': '#fad6a5',
    'tan': '#d2b48c',
    'tangelo': '#f94d00',
    'tangerine': '#f28500',
    'tangerine yellow': '#fc0',
    'tango pink': '#e4717a',
    'taupe': '#483c32',
    'taupe gray': '#8b8589',
    'tea green': '#d0f0c0',
    'tea rose (orange)': '#f88379',
    'tea rose (rose)': '#f4c2c2',
    'teal': '#008080',
    'teal blue': '#367588',
    'teal green': '#00827f',
    'telemagenta': '#cf3476',
    'tenné (tawny)': '#cd5700',
    'terra cotta': '#e2725b',
    'thistle': '#d8bfd8',
    'thulian pink': '#de6fa1',
    'tickle me pink': '#fc89ac',
    'tiffany blue': '#0abab5',
    "tiger's eye": '#e08d3c',
    'timberwolf': '#dbd7d2',
    'titanium yellow': '#eee600',
    'tomato': '#ff6347',
    'toolbox': '#746cc0',
    'topaz': '#ffc87c',
    'tractor red': '#fd0e35',
    'trolley grey': '#808080',
    'tropical rain forest': '#00755e',
    'true blue': '#0073cf',
    'tufts blue': '#417dc1',
    'tumbleweed': '#deaa88',
    'turkish rose': '#b57281',
    'turquoise': '#30d5c8',
    'turquoise blue': '#00ffef',
    'turquoise green': '#a0d6b4',
    'tuscan red': '#7c4848',
    'twilight lavender': '#8a496b',
    'tyrian purple': '#66023c',
    'ua blue': '#03a',
    'ua red': '#d9004c',
    'ube': '#8878c3',
    'ucla blue': '#536895',
    'ucla gold': '#ffb300',
    'ufo green': '#3cd070',
    'ultra pink': '#ff6fff',
    'ultramarine': '#120a8f',
    'ultramarine blue': '#4166f5',
    'umber': '#635147',
    'unbleached silk': '#ffddca',
    'united nations blue': '#5b92e5',
    'university of california gold': '#b78727',
    'unmellow yellow': '#ff6',
    'up forest green': '#014421',
    'up maroon': '#7b1113',
    'upsdell red': '#ae2029',
    'urobilin': '#e1ad21',
    'usafa blue': '#004f98',
    'usc cardinal': '#900',
    'usc gold': '#fc0',
    'utah crimson': '#d3003f',
    'vanilla': '#f3e5ab',
    'vegas gold': '#c5b358',
    'venetian red': '#c80815',
    'verdigris': '#43b3ae',
    'vermilion (cinnabar)': '#e34234',
    'vermilion (plochere)': '#d9603b',
    'veronica': '#a020f0',
    'violet': '#8f00ff',
    'violet-blue': '#324ab2',
    'violet (color wheel)': '#7f00ff',
    'violet (ryb)': '#8601af',
    'violet (web)': '#ee82ee',
    'viridian': '#40826d',
    'vivid auburn': '#922724',
    'vivid burgundy': '#9f1d35',
    'vivid cerise': '#da1d81',
    'vivid tangerine': '#ffa089',
    'vivid violet': '#9f00ff',
    'warm black': '#004242',
    'waterspout': '#a4f4f9',
    'wenge': '#645452',
    'wheat': '#f5deb3',
    'white': '#fff',
    'white smoke': '#f5f5f5',
    'wild blue yonder': '#a2add0',
    'wild strawberry': '#ff43a4',
    'wild watermelon': '#fc6c85',
    'wine': '#722f37',
    'wine dregs': '#673147',
    'wisteria': '#c9a0dc',
    'wood brown': '#c19a6b',
    'xanadu': '#738678',
    'yale blue': '#0f4d92',
    'yellow': '#ff0',
    'yellow-green': '#9acd32',
    'yellow (munsell)': '#efcc00',
    'yellow (ncs)': '#ffd300',
    'yellow orange': '#ffae42',
    'yellow (process)': '#ffef00',
    'yellow (ryb)': '#fefe33',
    'zaffre': '#0014a8',
    'zinnwaldite brown': '#2c1608'
}

palettes = {
    'xkcd':XKCD_NAME_TO_HEX,
    'wiki_color': WIKI_COLOR_NAME_TO_HEX,
    'flux_sdxl': FLUX_SDXL_NAME_TO_HEX,
    'css4':CSS4_NAME_TO_HEX,
    'css3':CSS3_NAMES_TO_HEX,
    'html4':HTML4_NAMES_TO_HEX
}

import torch
import re
from PIL import Image
from .imagefunc import Hex_to_RGB, AnyType, pil2tensor, tensor2pil, log, load_custom_size, find_best_match_by_similarity

any = AnyType("*")


class LS_ColorName:

    def __init__(self):
        self.NODE_NAME = 'ColorName'

    @classmethod
    def INPUT_TYPES(self):
        return {
            "required": {
                "color": ("STRING", {"default": "#000000", "forceInput":False},),
                "palette": (list(palettes.keys()),),
            },
            "optional": {
            }
        }

    RETURN_TYPES = ("STRING",)
    RETURN_NAMES = ("color_name",)
    FUNCTION = 'get_color_name'
    CATEGORY = '😺dzNodes/LayerColor'

    def get_color_name(self, color, palette):

        (r, g, b) = Hex_to_RGB(color)

        if palette == "flux_sdxl":
            color_table = FLUX_SDXL_NAME_TO_HEX
        elif palette == "wiki_color":
            color_table = WIKI_COLOR_NAME_TO_HEX
        elif palette == "xkcd":
            color_table = XKCD_NAME_TO_HEX
        elif palette == "css4":
            color_table = CSS4_NAME_TO_HEX
        elif palette == "css3":
            color_table = CSS3_NAMES_TO_HEX
        else:
            color_table = HTML4_NAMES_TO_HEX

        min_colors = {}
        for name, hex_code in color_table.items():
            r_c, g_c, b_c = Hex_to_RGB(hex_code)
            rd = (r_c - r) ** 2
            gd = (g_c - g) ** 2
            bd = (b_c - b) ** 2
            min_colors[(rd + gd + bd)] = name
        color_name = min_colors[min(min_colors.keys())]

        return (color_name,)


class LS_NameToColor:

    def __init__(self):
        self.NODE_NAME = 'NameToColor'

    @classmethod
    def INPUT_TYPES(self):
        size_list = ['custom']
        size_list.extend(load_custom_size())
        return {
            "required": {
                "color_name": ("STRING", {"default": "white", "forceInput":False},),
                "palette": (list(palettes.keys()),),
                "in_palette_only": ("BOOLEAN", {"default": False}),  # 仅在当前颜色表中查找
                "default_color": ("STRING", {"default": "#000000", "forceInput": False},),
                "size": (size_list,),
                "custom_width": ("INT", {"default": 512, "min": 4, "max": 99999, "step": 1}),
                "custom_height": ("INT", {"default": 512, "min": 4, "max": 99999, "step": 1}),
            },
            "optional": {
                "size_as": (any, {}),
            }
        }

    RETURN_TYPES = ("IMAGE", "STRING",)
    RETURN_NAMES = ("image", "color",)
    FUNCTION = 'name2color'
    CATEGORY = '😺dzNodes/LayerColor'

    def name2color(self, color_name, palette, in_palette_only, default_color, size, custom_width, custom_height, size_as=None):

        if palette == "flux_sdxl":
            color_table = FLUX_SDXL_NAME_TO_HEX
        elif palette == "wiki_color":
            color_table = WIKI_COLOR_NAME_TO_HEX
        elif palette == "xkcd":
            color_table = XKCD_NAME_TO_HEX
        elif palette == "css4":
            color_table = CSS4_NAME_TO_HEX
        elif palette == "css3":
            color_table = CSS3_NAMES_TO_HEX
        else:
            color_table = HTML4_NAMES_TO_HEX

        if size_as is not None:
            if size_as.shape[0] > 0:
                _asimage = tensor2pil(size_as[0])
            else:
                _asimage = tensor2pil(size_as)
            width, height = _asimage.size
        else:
            if size == 'custom':
                width = custom_width
                height = custom_height
            else:
                try:
                    _s = size.split('x')
                    width = int(_s[0].strip())
                    height = int(_s[1].strip())
                except Exception as e:
                    log(f'Warning: {self.NODE_NAME} invalid size, check "custom_size.ini"', message_type='warning')
                    width = custom_width
                    height = custom_height

        color_name = color_name.lower()
        print(f"color_name={color_name}")

        ret_color = ""
        try:
            ret_color = color_table[color_name]
        except KeyError:
            if not in_palette_only:
                for table_name, table in palettes.items():
                    try:
                        ret_color = table[color_name]
                        break
                    except KeyError:
                        pass
                if ret_color != "":
                    log(f'{self.NODE_NAME}: "{color_name}" not in current color table, find it in "{table_name}".')
                else: # 在全部色表中寻找最近似名称
                    match_keys = {}
                    for table_name, table in palettes.items():
                        match_key = find_best_match_by_similarity(color_name, list(table.keys()))
                        if match_key is not None:
                            match_keys[match_key] = table_name

                    if match_keys == {}:
                        log(f'{self.NODE_NAME}: "{color_name}" not in color tables and not find any approximation, return default color.')
                        ret_color = default_color
                    else:
                        print(f"finded {len(match_keys)} keys:{match_keys}")
                        match_key = find_best_match_by_similarity(color_name, list(match_keys.keys()))
                        log(f'{self.NODE_NAME}: "{color_name}" not in color tables, return the approximation "{match_key}" in "{match_keys[match_key]}".')
                        ret_color = palettes[match_keys[match_key]][match_key]

            else:
                log(f'{self.NODE_NAME}: "{color_name}" not in current color table, return default color.')
                ret_color = default_color

        ret_image = Image.new('RGB', (width, height), color=ret_color)

        return (pil2tensor(ret_image), ret_color,)


NODE_CLASS_MAPPINGS = {
    "LayerUtility: ColorName": LS_ColorName,
    "LayerUtility: NameToColor": LS_NameToColor,
}

NODE_DISPLAY_NAME_MAPPINGS = {
    "LayerUtility: ColorName": "LayerUtility: Color Name",
    "LayerUtility: NameToColor": "LayerUtility: Name To Color",
}